import java.util.HashMap;
import java.util.*;
class Node {
    int val;
    Node next;
    Node random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }
}
public class TESt {

    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            String b = in.nextLine();
            badKeyBroad(a,b);
        }
    }
    public static void badKeyBroad(String str1,String str2){
        char[] ch1 = str1.toUpperCase().toCharArray();
        char[] ch2 = str2.toUpperCase().toCharArray();
        HashSet<Character> hashSet = new HashSet<>();

        for(int i = 0;i < str2.length();i++){
            if(!hashSet.contains(ch2[i])){
                hashSet.add(ch2[i]);
            }
        }
        HashSet<Character> hashSet1 = new HashSet<>();
        for(int j = 0;j < str1.length();j++){
            if(!hashSet.contains(ch1[j]) && !hashSet1.contains(ch1[j]) ){
                hashSet1.add(ch1[j]);
                System.out.print(ch1[j]);
            }

        }

    }
    public Node copyRandomList(Node head) {
        HashMap<Node,Node> hashMap = new HashMap<>();

        Node cur = head;
        //创建新的节点
        while (cur != null){
            Node newNode = new Node(cur.val);
            hashMap.put(cur,newNode);
            cur = cur.next;
        }

        cur = head;
        //赋值
        while(cur != null){
            hashMap.get(cur).next = hashMap.get(cur.next);
            hashMap.get(cur).random = hashMap.get(cur.random);
            cur = cur.next;
        }

        return hashMap.get(head);

    }
}
